<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Computes the step response of a linear system</title>
<link rel="canonical" href="/Users/mcgrant/Projects/CVX/examples/circuit_design/html/simple_step.html">
<link rel="stylesheet" href="../../examples.css" type="text/css">
</head>
<body>
<div id="header">
<h1>Computes the step response of a linear system</h1>
Jump to:&nbsp;&nbsp;&nbsp;&nbsp;
<a href="#source">Source code</a>&nbsp;&nbsp;&nbsp;&nbsp;
Text output
&nbsp;&nbsp;&nbsp;&nbsp;
Plots
&nbsp;&nbsp;&nbsp;&nbsp;<a href="../../index.html">Library index</a>
</div>
<div id="content">
<a id="source"></a>
<pre class="codeinput">
<span class="keyword">function</span> X = simple_step(A,B,DT,N)
n  = size(A,1);
Ad = expm( full( A * DT ) );
Bd = ( Ad - eye(n) ) * B;
Bd = A \ Bd;
X  = zeros(n,N);
<span class="keyword">for</span> k = 2 : N,
    X(:,k) = Ad*X(:,k-1)+Bd;
<span class="keyword">end</span>
</pre>
</div>
</body>
</html>